import { BaseCommand } from "./BaseCommand";
import { API_EVENT, COMMAND_STATUS } from "@/FrontProcessing/interface";
/**
 * Cmd_Fill_Hole
 * @description 二维网格编辑-填孔
 */
export class Cmd_Fill_Hole extends BaseCommand {
  event = API_EVENT.FILL_HOLE;
  execute(): Promise<boolean> {
    this.system.history.push(this);
    return new Promise((resolve, reject) => {
      this.status = COMMAND_STATUS.RUNNING;
      this.system
        .fill_hole({
          ...this.params,
        })
        .then((result) => {
          this.status = COMMAND_STATUS.FINISHED;
          resolve(result);
        })
        .catch(err => reject(err));
    });
  }

  undo(): boolean {
    return false;
  }
}
